package cn.btks.resultintegration.achievements.repository;

import cn.btks.resultintegration.achievements.pojo.TextAchievements;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

/**
 * @Author lijun
 * @Date 2021/1/6 12:09
 */
@Repository
public interface TextAchievementsRepository extends JpaRepository<TextAchievements,Long>, JpaSpecificationExecutor<TextAchievements> {

    /**
     * 根据环境管控单元编码查询
     * @param unitCode
     * @return
     */
    TextAchievements findByUnitCode(String unitCode);

    /**
     * 根据ID删除文本成果
     * @param id
     * @return
     */
    @Modifying
    @Query(value = "delete from text_achievements where identity = ?1",nativeQuery = true)
    int delete(Long id);
}
